package com.transcendence.appwidget;

import android.app.Activity;
import android.app.Application;
import android.content.Intent;

import com.jinrishici.sdk.android.factory.JinrishiciFactory;
import com.transcendence.appwidget.updatetime.UpdateTimeService;
import com.transcendence.core.base.app.CoreApp;
import com.transcendence.core.base.manager.ActivityManager;
import com.transcendence.core.utils.log.LogUtils;

/**
 * @author joephone
 * @date 2023/9/14
 * @desc
 */
public class App extends Application implements ActivityManager.ApplicationLifecycleCallback {

    @Override
    public void onCreate() {
        super.onCreate();
        JinrishiciFactory.init(this);
    }

    /**
     * 第一个 Activity 创建了
     *
     * @param activity
     */
    @Override
    public void onApplicationCreate(Activity activity) {
        LogUtils.d("onApplicationCreate");
        startService(new Intent(activity, UpdateTimeService.class));
    }

    /**
     * 最后一个 Activity 销毁了
     *
     * @param activity
     */
    @Override
    public void onApplicationDestroy(Activity activity) {
        LogUtils.d("onApplicationDestroy");
    }

    /**
     * 应用从前台进入到后台
     *
     * @param activity
     */
    @Override
    public void onApplicationBackground(Activity activity) {

    }

    /**
     * 应用从后台进入到前台
     *
     * @param activity
     */
    @Override
    public void onApplicationForeground(Activity activity) {

    }
}
